import { RouterProvider } from 'react-router-dom';
import { ConfigProvider, theme } from 'antd';
import router from './routes';
import useStore from './store';
import { lightTheme, darkTheme } from './theme';

function App() {
  const currentTheme = useStore((state) => state.theme);

  return (
    <ConfigProvider
      theme={{
        ...currentTheme === 'dark' ? darkTheme : lightTheme,
        algorithm: currentTheme === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm,
      }}
    >
      <RouterProvider router={router} />
    </ConfigProvider>
  );
}

export default App;